<template>
  <el-dialog
      :title="title"
      custom-class="x-large-dialog"
      :visible="visible"
      append-to-body
      @open="open"
      @close="close"
  >
    <div class="search-pannel">
      <el-form
          class="search-form"
          :model="postData"
          label-position="top"
          ref="postForm"
      >
        <el-row>
          <el-col :span="12">
            <el-form-item label="房屋图片" prop="pictures">
              <file-upload
                  v-model="postData.pictures"
                  acceptType="image"
                  :limit="3"
              ></file-upload>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="房屋面积（平方米）" prop="houseArea">
              <el-input v-model.number="postData.houseArea" placeholder="请输入房屋面积"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="房屋楼层" prop="floor">
              <el-input v-model="postData.floor" placeholder="请输入房屋楼层" maxlength="20" show-word-limit></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="房型" prop="type">
              <el-input v-model="postData.type" placeholder="请输入房型" maxlength="20" show-word-limit></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="宜居人数" prop="type">
              <el-input v-model.number="postData.personNum" show-word-limit></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="朝向" prop="type">
              <el-input v-model="postData.direction" placeholder="请输入朝向" maxlength="20" show-word-limit></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="18">
            <el-form-item label="备注" prop="remarks">
              <el-input type="textarea" v-model="postData.remarks" placeholder="请输入备注" maxlength="500" show-word-limit></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="18">
            <el-form-item label="房屋描述" prop="content">
              <el-input type="textarea" v-model="postData.content" placeholder="请输入房屋描述" maxlength="500" show-word-limit></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div slot="footer">
      <el-button @click="close">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { _put, _getDetail } from '../src/store'
import { getAllArea, postDialog } from '@/mixins'

export default {
  name: 'postDialog',
  mixins: [postDialog, getAllArea],
  data() {
    return {
      postData: {
        content: '',
        pictures: '',
        houseArea: 0,
        direction: '',
        floor: '',
        type: '',
        remarks: '',
        personNum: 0
      },
      editFunc: _put,
      detailFunc: _getDetail
    }
  }
}
</script>

<style scoped>

</style>
